home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / U-Z / VideoToolBox Folder / VideoToolboxSources / VideoToolbox.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-16  |  20.8 KB  |  669 lines  |  [TEXT/KAHL]

  1. /*
  2. VideoToolbox.h
  3. This file contains the necessary prototypes for use of all the VideoToolbox
  4. files except Luminance.c, which has its own header file, Luminance.h.
  5.  
  6. Any C file that might be used as a MATLAB file should #include <VideoToolbox.h>
  7. as it's first C statement.
  8.  
  9. Copyright 1989-1993 © Denis G. Pelli
  10.  
  11. HISTORY: (omitting changes documented in *.c files)
  12. 2/20/93 dhb    Added various commonly used headers.  
  13.             Restructured so that only VideoToolbox.h has to be included,
  14.             whether one is creating stand-alone THINK C or code resources
  15.             to be called by MatLab. Everything that cares is properly conditioned
  16.             by symbol MATLAB or UCSB.
  17.             
  18. */
  19. #pragma once            // suppress multiple inclusions of this file
  20. #ifndef _VIDEOTOOLBOX_    // suppress multiple inclusions of this file
  21. #define _VIDEOTOOLBOX_
  22.  
  23. /*
  24. Header files that are required for succesful compilation of this file are marked
  25. "required". 
  26.  
  27. Header files whose precompilation depends on the mc68881 or mc68020 THINK C
  28. compiler options (e.g. math.h and mc68881.h) were omitted from VideoToolbox.h so
  29. that the resulting precompiled header file can be used in projects regardless of
  30. those options. (You'll want them enabled in your experiments to make full use of
  31. your hardware, but you'll usually want them disabled in demo programs for
  32. maximum compatibility with other peoples computers.) However, changing other
  33. options (e.g. size of double or size of int) will still make it necessary to
  34. rebuild the precompiled header file, to reflect the new settings.
  35.  
  36. The VideoToolbox sources can be linked to create a stand-alone C application, or
  37. a MatLab external code resource (a "MEX" or "MATLAB" file), to be invoked by
  38. typing the function name from within MatLab. The symbol MATLAB, if defined,
  39. enables the creation of a MATLAB file. We suggest that if you want to create a
  40. MATLAB file, then you should type "#define MATLAB", without the quotes, into the
  41. Prefix window of your THINK C project (try menu Edit:Options:Prefix). This will
  42. have the same effect as typing it at the top of every C file in your project,
  43. but without modifying the source files. dhb & dgp.
  44. */
  45. #include <stdio.h>        // required
  46. #include <stdlib.h>
  47. // This includes the MATLAB header if appropriate.  Otherwise it
  48. // defines some data types that are provided by the MATLAB header
  49. // so that code that uses these types may be compiled for use in
  50. // applications.
  51. #ifdef MATLAB
  52.     // Must come after stdlib.h and stdio.h, and before everything else.
  53.     #include <cmex.h>
  54. #else
  55.     typedef long int INT;
  56.     typedef short double DOUBLE;
  57.     typedef struct {
  58.         char *name;
  59.         INT type;
  60.         INT m;
  61.         INT n;
  62.         DOUBLE *pr;
  63.         DOUBLE *pi;
  64.     } Matrix;
  65. #endif
  66. // ANSI headers
  67. #include <ctype.h>
  68. #include <float.h>
  69. #include <limits.h>
  70. #include <string.h>
  71. #include <time.h>
  72. // Macintosh headers
  73. #if THINK_C
  74.     #include <console.h>
  75. #endif
  76. #include <Devices.h>
  77. #include <Events.h>
  78. #include <FixMath.h>    // Must come before mc68881.h
  79. #include <Fonts.h>
  80. #include <GestaltEqu.h>
  81. #include <Memory.h>
  82. #include <OSEvents.h>
  83. #include <OSUtils.h>    // required
  84. #include <Palettes.h>    // formerly Palette.h
  85. #if THINK_C
  86.     #include <pascal.h>    // c2pstr(),CtoPStr()
  87. #endif
  88. #include <QDOffscreen.h>// formerly QuickDraw32Bit.h
  89. #include <QuickDraw.h>    // required
  90. #include <Resources.h>
  91. #include <Retrace.h>    // required
  92. #include <Slots.h>
  93. #include <Sound.h>
  94. #ifndef THINK_C            // e.g. MPW C
  95.     #include <Strings.h>// c2pstr(),CtoPStr()
  96. #endif
  97. #include <Timer.h>        // required
  98. #include <ToolUtils.h>
  99. #include <Video.h>
  100. #include <Windows.h>    // required
  101.  
  102. /*
  103. This next bit is only for MATLAB files, to deal with QuickDraw globals. In THINK
  104. C we have to explicitly allocate space for QuickDraw globals and InitGraf them
  105. when our code resource is first invoked. VideoToolbox.h will be included in all
  106. the C files that make up your MATLAB project. The symbol "MAIN" determines
  107. whether the global structure mex_qd is allocated or just declared as extern.
  108. THINK C complains if space is allocated more than once or never allocated.  So
  109. you need to "#define MAIN 1" at the start of one file in every MATLAB project. I
  110. always do it in the file that contains the entry point (e.g. main or
  111. user_fcn).-- dhb.
  112. */
  113. #ifdef MATLAB
  114.     #ifdef THINK_C
  115.         #ifdef MAIN
  116.             THINK_C_QD mex_qd;    // Allocate storage for QD globals.
  117.         #else
  118.             extern THINK_C_QD mex_qd;
  119.         #endif
  120.         #define qd mex_qd
  121.     #else
  122.         #define mex_qd qd
  123.     #endif
  124. #endif
  125.  
  126. /*
  127. TRUE and FALSE
  128. */
  129. #ifndef TRUE
  130.     #define FALSE    0
  131.     #define TRUE    1
  132. #endif
  133.  
  134. /*
  135. NAN & INF
  136. If you're using NAN and INF you'll be interested in the IsNan(), IsInf(), and
  137. IsFinite() definitions & prototypes below. Note that the THINK C compiler is
  138. timid, worried about possible exception events, so the INF and NAN expressions
  139. below are evaluated at runtime. (Drat!) If you use these expressions in a tight
  140. loop, you'd be better off putting the value in a variable (preferably a
  141. register) and using that instead.
  142. */
  143. #if !defined(INF)
  144.     #define INF    (1.0/0.0)        /* Infinity */
  145. #endif
  146. #if !defined(NAN)
  147.     #define NAN    (0.0/0.0)        /* Not a Number */
  148. #endif
  149. /*
  150. NUMERICAL CONSTANTS
  151. It's sad to say, but THINK C 5.02 loses two bits of precision converting between
  152. doubles and ascii text, in either direction. Thus you will obtain more accurate
  153. results by computing the numerical constants below at runtime rather than using
  154. these predefined constants. The ANSI Numerical C Extensions group is moving to
  155. require C compilers to preserve precision, so there is hope for the future. Of
  156. course most applications would never notice a loss of two bits precision out of
  157. the total double precision given by the 64 bits in the mantissa.
  158. */
  159. #if !defined(PI)
  160.     #define PI        3.1415926535897932385    /* computed in Mathematica */
  161. #endif
  162. #if !defined(LOGPI)
  163.     #define LOGPI    1.14472988584940017414    /* computed in Mathematica */
  164. #endif
  165. #if !defined(LOG2)
  166.     #define LOG2    0.69314718055994530942    /* computed in Mathematica */
  167. #endif
  168. #if !defined(LOG10)
  169.     #define LOG10    2.30258509299404568402    /* computed in Mathematica */
  170. #endif
  171.  
  172. /*
  173. COLORS
  174. The number of colors that a video device can display, in its current mode.
  175. */
  176. #define GDCOLORS(device) ((**(**(**device).gdPMap).pmTable).ctSize+1)
  177.  
  178. /*
  179. FIXED POINT ARITHMETIC
  180. Apple defines a handy data type called Fixed that is stored in a long, but is
  181. assumed to have a decimal point in the middle. Many operations, e.g. adding two
  182. Fixed numbers or multiplying or dividing a Fixed by an integer, can be performed
  183. directly. To multiply or divide two Fixed numbers use Apple's FixMul() and
  184. FixDiv(). FixRatio(n,m) returns the Fixed ratio of two integers. Macintosh C
  185. compilers define double in various ways, depending on whether a floating point
  186. unit is to be used. The Apple-provided routines for doing type conversion to and
  187. from Fixed are only appropriate if you are NOT using the floating point unit.
  188. The ones defined below are faster and work with or without the FPU.
  189. */
  190. #define LongToFix(x) ((long)(x)<<16)
  191. #define FixToLong(x) ((x)>>16)
  192. #define DoubleToFix(x) ((Fixed)((x)*65536.+0.5))
  193. #define FixToDouble(x) ((double)(x)*(1./65536.))
  194.  
  195. /*
  196. STACK
  197. StackGrow(n) increases the stack allocation by n bytes. You'll also want to use
  198. Apple's StackSpace(), declared in Memory.h, that returns the number of bytes 
  199. allocated for the stack.
  200. */
  201.  
  202. #define StackGrow(extraBytes) SetApplLimit(GetApplLimit()-(extraBytes))
  203.  
  204. /* Binomial.c */
  205.  
  206. long    BinomialSample(double p,long n);
  207. int        BinomialSampleQuickly(int n);
  208. double    BinomialLowerBound(double P,long k,long n);
  209. double    BinomialUpperBound(double P,long k,long n);
  210. double    BinomialPdf(double p,long k,long n);
  211. double    Binomial(double p,long k,long n);
  212. double    IncompleteBeta(double x,double a,double b);
  213. double    InverseBinomial(double P,long k,long n);
  214. double    InverseIncompleteBeta(double p,double a,double b);
  215.  
  216. /* BreakLines.c */
  217.  
  218. char *BreakLines(char *string,long lineLength);
  219.  
  220. /* CardSlot.c */
  221.  
  222. OSErr    CardSlot(char *cardName);
  223.  
  224. /* CenterRectInRect.c */
  225.  
  226. void    CenterRectInRect(Rect *moveableRectPtr,Rect *fixedRectPtr);
  227. void    OffsetRectTile(Rect *r,int nx,int ny);
  228. Boolean    RectInRect(Rect *r,Rect *R);
  229.  
  230. /* ChiSquare.c */
  231.  
  232. double    PChiSquare (double chiSquare,int n);
  233.  
  234.  
  235. /* ConvolveX.c */
  236.  
  237. void    ConvolveX(double f[],int dim,BitMap *srcBits,BitMap *dstBits,
  238.             Rect *srcRectPtr,Rect *dstRectPtr);
  239.  
  240. /* ConvolveY.c */
  241.  
  242. void ConvolveY(double f[],int dim,BitMap *srcBits,BitMap *dstBits,
  243.             Rect *srcRectPtr,Rect *dstRectPtr);
  244.  
  245. /* CopyBitsQuickly.c */
  246.  
  247. enum{mulOver=128};
  248. int    CopyBitsQuickly(BitMap *srcBits,BitMap *dstBits,
  249.             Rect *srcRectPtr,Rect *dstRectPtr,int srcMode,RgnHandle maskRgn);
  250.  
  251. /* CopyQuickDrawGlobals.c */
  252.  
  253. void CopyQuickDrawGlobals(void);
  254. #define CopyQuickdrawGlobals CopyQuickDrawGlobals    // old spelling
  255.  
  256. /* CreateTrialSnds.c */
  257.  
  258. void CreateTrialSnds(void);
  259.  
  260. /* DateString.c */
  261.  
  262. char    *DateString(unsigned long seconds);
  263.  
  264. /* DrawPrintf.c */
  265.  
  266. void DrawPrintf(char *s, ...);
  267.  
  268. /* ffprintf.c */
  269.  
  270. int ffprintf(FILE *stream[2],char *format,...);
  271.  
  272. /* FlushCacheRange.c */
  273.  
  274. void FlushCacheRange (void *address, unsigned long count);
  275.  
  276. /* GDOpenWindow.c */
  277.  
  278. void AddExplicitPalette(WindowPtr window);
  279. WindowPtr GDOpenWindow1(GDHandle device);
  280. void GDDisposeWindow1(WindowPtr window);
  281. CWindowPtr GDOpenWindow(GDHandle device);                    // Old. Use GD...1 instead.
  282. void GDDisposeWindow(GDHandle device,CWindowPtr myWindow);    // Old. Use GD...1 instead.
  283.  
  284. /* GDPrintf.c */
  285.  
  286. void    GDPrintf(char *s, ...);
  287.  
  288. /* GDFrameRate.c */
  289.  
  290. double GDClutUpdateRate(GDHandle device,long clutEntries);    // Use GDTimeClutUpdate instead.
  291. double GDFrameRate(GDHandle device);
  292. double GDFramesPerClutUpdate(GDHandle device,long clutEntries);    // Use GDTimeClutUpdate instead.
  293. double GDMovieRate(GDHandle device,int quickly);
  294. double GDMovieSize(GDHandle device,int quickly);
  295. void GDTimeClutUpdate(GDHandle device,long clutEntries,double *framesPtr,double *sPtr);
  296. double GDVBLRate(GDHandle device);
  297. double TickRate(void);
  298.  
  299. /* GDTimeClut.c */
  300.  
  301. typedef OSErr (*SetEntriesFunction)(GDHandle device,short start,short count
  302.     ,ColorSpec *aTable);
  303. OSErr GDTimeClut(GDHandle device,SetEntriesFunction function,short clutEntries
  304.     ,double *sPtr,double *framesPtr,double *missingFramesPtr,double *frameRatePtr);
  305.  
  306. /* GDVideo.c */
  307.  
  308. #define MAX_SCREENS 8
  309. char  *GDCardName(GDHandle device);
  310. short GDClutSize(GDHandle device);
  311. OSErr GDControl(int refNum,int csCode,Ptr csParamPtr);
  312. OSErr GDDirectSetEntries(GDHandle device,short start,short count,ColorSpec *aTable);
  313. OSErr GDGetDefaultGamma(GDHandle device,GammaTbl **gammaTbl);
  314. OSErr GDGetDefaultMode(GDHandle device,short *modePtr);
  315. OSErr GDGetEntries(GDHandle device,short start,short count,ColorSpec *aTable);
  316. OSErr GDGetGamma(GDHandle device,GammaTbl **myGammaTblHandle);
  317. OSErr GDGetGray(GDHandle device,Boolean *flagPtr);
  318. OSErr GDGetInterrupt(GDHandle device,Boolean *flagPtr);
  319. OSErr GDGetMode(GDHandle device,short *modePtr,short *pagePtr,Ptr *baseAddrPtr);
  320. OSErr GDGetPageBase(GDHandle device,short page,Ptr *baseAddrPtr);
  321. OSErr GDGetPageCnt(GDHandle device,short mode,short *pagesPtr);
  322. OSErr GDGrayPage(GDHandle device,short page);
  323. #define GDLinearGamma GDUncorrectedGamma /* old name, before 12/16/92 */
  324. char *GDModeName(short mode);
  325. unsigned char *GDName(GDHandle device);
  326. OSErr GDReset(GDHandle device,short *modePtr,short *pagePtr,Ptr *baseAddrPtr);
  327. OSErr GDRestoreDeviceClut(GDHandle device);
  328. OSErr GDRestoreGamma(GDHandle device);
  329. OSErr GDSaveGamma(GDHandle device);
  330. OSErr GDSetDefaultMode(GDHandle device,short mode);
  331. OSErr GDSetEntries(GDHandle device,short start,short count,ColorSpec *aTable);
  332. OSErr GDSetEntriesByType(GDHandle device,short start,short count,ColorSpec *table);
  333. OSErr GDSetEntriesByTypeHighPriority(GDHandle device,short start,short count
  334.     ,ColorSpec *table);
  335. OSErr GDSetGamma(GDHandle device,GammaTbl *myGammaTblPtr);
  336. OSErr GDSetGray(GDHandle device,Boolean flag);
  337. OSErr GDSetInterrupt(GDHandle device,Boolean flag);
  338. OSErr GDSetMode(GDHandle device,short mode,short page,Ptr *baseAddrPtr);
  339. OSErr GDSetPageDrawn(GDHandle device,short page);
  340. OSErr GDSetPageShown(GDHandle device,short page);
  341. OSErr GDStatus(int refNum,int csCode,Ptr csParamPtr);
  342. OSErr GDUncorrectedGamma(GDHandle device);
  343. int  GDVersion(GDHandle device);
  344. #define ModeName GDModeName   /* old name, before 1/18/93 */
  345. int  PatchMacIIciVideoDriver(void);
  346.  
  347. /* GetClicks.c */
  348.  
  349. short    GetClicks(void);
  350.  
  351. /* GetScreenDevice.c */
  352.  
  353. GDHandle    GetScreenDevice(int n);
  354. int GetScreenIndex(GDHandle device);
  355. GDHandle    GetWindowDevice(WindowPtr theWindow);
  356. GDHandle    AddressToScreenDevice(Ptr address);
  357. GDHandle    SlotToScreenDevice(int n);
  358. short int    GetDeviceSlot(GDHandle device);
  359. short int    AddressToSlot(Ptr address);
  360. void        LocalToGlobalRect(Rect *r);
  361. void        GlobalToLocalRect(Rect *r);
  362.  
  363.  
  364. /* GetVoltage.c */
  365.  
  366. double    VoltsDuringFrame(double frames);
  367. double    GetVoltage(short channel,double *gainPtr,double *frequencyPtr,long n
  368.             ,double *sdPtr);
  369. short    GetVoltages(short channel,double *gainPtr,double *frequencyPtr,long *nPtr
  370.             ,unsigned short readings[],double *voltDeltaPtr,double *voltZeroPtr);
  371. short    InitiateVoltageSampling(short channel,double *gainPtr,double *frequencyPtr
  372.             ,double *voltDeltaPtr,double *voltZeroPtr);
  373. short    RetrieveVoltages(long *nPtr,unsigned short readings[]);
  374. int        ForeRunnerSlot(void);
  375. enum{voltageBufferOverflow=1<<0,voltageOverflow=1<<1,voltageUnderflow=1<<2};
  376.  
  377. /* HideMenuBar.c */
  378.  
  379. void    HideMenuBar(void);
  380. void    ShowMenuBar(void);
  381. void SquareCorners(GDHandle device);
  382. void RestoreCorners(GDHandle device);
  383. void UnclipScreen(GDHandle device);
  384. void RestoreScreenClipping(GDHandle device);
  385.  
  386. /* Identify.c */
  387.  
  388. char *IdentifyCompiler(void);
  389. char *IdentifyMachine(void);
  390. char *IdentifyModel(void);
  391. char *IdentifyVideo(GDHandle device);
  392.  
  393. /* IsNan.c */
  394.  
  395. int IsNan(double x);
  396. int IsInf(double x);
  397. #ifndef IsFinite
  398.     #define IsFinite(x) ((*(short *)&(x) & 32767)!=32767)    /* neither NAN nor ±INF */
  399. #endif
  400.  
  401. /* kbhit.c */
  402.  
  403. int    kbhit(void);
  404. int    getcharUnbuffered(void);
  405. Boolean YesOrNo(Boolean defaultAnswer);
  406.  
  407. /* Log2L.c */
  408.  
  409. long Log2L(unsigned long j);
  410.  
  411. /* MakeNoise.c */
  412.  
  413. Boolean MakeNoise1(double dx,double dy,Boolean randomPhase,PixMap *frame);
  414. void    MakeNoise(double dx,double dy,PixMap frame[],short *maxFramesPtr);
  415.  
  416. /* MaximizeConsoleHeight.c */
  417.  
  418. void MaximizeConsoleHeight(void);
  419.  
  420. /* Mean.c */
  421.  
  422. double    Mean(double x[],long n,double *sdPtr);
  423.  
  424. /* MyFgets.c */
  425.  
  426. char    *MyFgets(char *s, int length, FILE *stream);
  427.  
  428. /* Normal.c */
  429.  
  430. double    NormalPdf(double x);
  431. double    Normal(double x);
  432. double    InverseNormal(double p);
  433. double    NormalSample(void);
  434. double Normal2DPdf(double r);
  435. double Normal2D(double r);
  436. double InverseNormal2D(double p);
  437. double Normal2DSample(void);
  438. double InverseNormal2DPdf(double p);
  439.  
  440. /* nrand.c */
  441.  
  442. int nrand(short n);
  443. unsigned short nrandU(unsigned short n);
  444. unsigned long nrandUL(unsigned long n);
  445.  
  446. /*    OpenDataFiles.c */
  447.  
  448. unsigned long    OpenDataFiles(FILE **inPtr,FILE **outPtr
  449.                     ,char *inName,char *outName);
  450.  
  451. /*    PixMapToPostScript */
  452.  
  453. void    PixMapToPostScript(char *filename,PixMap *pm,Rect *rectPtr
  454.             ,Rect *pageRectPtr,double cellsPerInch,int grayLevels);
  455. void    AppendToFile(char *filename,char *string);
  456.  
  457. /* PlotXY.c */
  458.  
  459. typedef struct{
  460.     Boolean continuing;    /* zero to start a new curve */
  461.     long color;            /* e.g. blackColor, blueColor */
  462.     short lineWidth;    /* in pixels, zero for none */
  463.     short symbolWidth;    /* in pixels, zero for none */
  464.     short dashOffset;    /* in pixels */
  465.     short dash[5];        /* in pixels. The array is terminated by a zero element */
  466.     short h,v;            /* reserved for internal use */
  467.     Fixed pathLengthF;    /* reserved for internal use */
  468. } PlotXYStyle;
  469. void PlotXY(WindowPtr window,double x,double y,PlotXYStyle *style);
  470.  
  471. /* PrintfExit.c */
  472.  
  473. int PrintfExit(char *format,...);
  474. void Require(long quickDrawVersion);
  475.  
  476. /* QD32Exists.c */
  477.  
  478. Boolean         QD8Exists(void);
  479. Boolean            QD32Exists(void);
  480. Boolean            NewPaletteManager(void);
  481.  
  482. /* randU.c */
  483.  
  484. unsigned short    randU(void);
  485. unsigned long    randUL(void);
  486. void            srandU(unsigned n);
  487. void            RandFill(void *address,long bytes);
  488.  
  489.  
  490. /* ReadAssignments.c */
  491.  
  492. enum{echoAssignments=1,echoComments=2,echoFile=4};
  493. enum{charType=1,shortType,longType,unsignedCharType,unsignedShortType,unsignedLongType
  494.     ,doubleType,stringType};
  495. typedef struct {
  496.     short type;
  497.     char *name;
  498.     void *ptr;
  499. } Variable;
  500. void PrintAssignment(FILE *file,Variable *v);
  501. Boolean AssignmentLineWasBlank(void);
  502. int ReadAssignmentLine(FILE *file,Variable variable[],int echo);
  503. int ReadAssignmentBlock(FILE *file,Variable variable[],int echo);
  504. int ReadAssignmentFile(char *filename,Variable variable[],int echo);
  505. int InitializeVariables(Variable variable[]);
  506. void InitializeAVariable(Variable *variable);
  507. Variable SetVariable(int type,void *ptr,char *name);
  508.  
  509. /* ReadMatLabFile.c */
  510.  
  511. int LoadMatDoubles(FILE *f,char *name,long *rows,long *cols
  512.     ,double **real,double **imag);
  513. int LoadMatShorts(FILE *f,char *name,long *rows,long *cols
  514.     ,short **real,short **imag);
  515. int SaveMatDoubles(FILE *f,char *name,long rows,long cols,double *real,double *imag);
  516. int SaveMatShorts(FILE *f,char *name,long rows,long cols,short *real,short *imag);
  517.  
  518. /* RectToAddress.c */
  519.  
  520. unsigned char    *RectToAddress(PixMap *myPixMapPtr,Rect *myRectPtr
  521.                     ,short *myRowBytesPtr,short *myPixelSizePtr,short *bitsOffsetPtr);
  522.  
  523. /* RestoreCluts.c */
  524.  
  525. void RestoreCluts(void);
  526.  
  527. /*    SetEntriesQuickly.c */
  528.  
  529. OSErr SetEntriesQuickly(GDHandle device,short start,short count,ColorSpec *table);
  530. short macltset(GDHandle device,register short start
  531.     ,short *red,short *green,short *blue,short count1);
  532. short GetCardType(GDHandle device);
  533. char *GetCardBase(GDHandle device);
  534. OSErr WaitForNextBlanking(GDHandle device);
  535.  
  536. /* SetFileInfo.c */
  537.  
  538. void    SetFileInfo(char *fileName,OSType fileType,OSType fileCreator);
  539.  
  540. /* SetMouse.c */
  541.  
  542. void    SetMouse(Point mouseLoc);
  543.  
  544. /* SetOnePixel.c */
  545.  
  546. void SetPixmapPixel(PixMap *pmHandle,int x,int y,unsigned long value);
  547. unsigned long GetPixmapPixel(PixMap *pmHandle,int x,int y);
  548. unsigned char *GetPixmapPixelAddress(PixMap *pmHandle,int x,int y);
  549. void SetDevicePixel(GDHandle device,int x,int y,unsigned long value);
  550. unsigned long GetDevicePixel(GDHandle device,int x,int y);
  551. void SetOnePixel(int x,int y,unsigned long value);
  552. unsigned long GetOnePixel(int x,int y);
  553. #define SetIPixel SetDevicePixel    // So that old programs won't break.
  554. #define GetIPixel GetDevicePixel    // So that old programs won't break.
  555.  
  556. /* SetPixelsQuickly.c */
  557.  
  558. int SetPixelsQuickly(int x,int y,unsigned long value[],short n);
  559. int GetPixelsQuickly(int x,int y,unsigned long value[],short n);
  560. int SetWindowPixelsQuickly(WindowPtr window,int x,int y,unsigned long value[],short n);
  561. int GetWindowPixelsQuickly(WindowPtr window,int x,int y,unsigned long value[],short n);
  562. int SetDevicePixelsQuickly(GDHandle device,int x,int y,unsigned long value[],short n);
  563. int GetDevicePixelsQuickly(GDHandle device,int x,int y,unsigned long value[],short n);
  564. int SetPixmapPixelsQuickly(PixMapPtr pmPtr,int x,int y,unsigned long value[],short n);
  565. int GetPixmapPixelsQuickly(PixMapPtr pmPtr,int x,int y,unsigned long value[],short n);
  566.  
  567. /* SetPriority.c */
  568.  
  569. void SwapPriority(char *priority);
  570. void SetPriority(int i);
  571. int GetPriority(void);
  572.  
  573. /* Shuffle.c */
  574.  
  575. void    Shuffle(short array[],long size);
  576.  
  577. /* SndPlay1.c */
  578.  
  579. OSErr SndPlay1(Handle snd);
  580. void SndStop1(void);
  581. short SndDone1(void);
  582.  
  583. /* StringToDate.c */
  584.  
  585. double StringToDate(char *string,DateTimeRec *date);
  586.  
  587. /* Timer.c */
  588.  
  589. struct Timer{
  590.     TMTask time;
  591.     long ourA5;
  592.     long interval,elapsed,elapsedIntervals;
  593.     long timeToStartTimer;            // minimum time in µs
  594.     long stopDelay;                    // µs from call to stop, re from call to start
  595.     long timeManagerVersion;
  596.     struct Timer *next,*previous;    // doubly linked list of Timers
  597. };
  598. typedef struct Timer Timer;
  599.  
  600. Timer *NewTimer(void);
  601. void DisposeTimer(Timer *t);
  602. void StartTimer(Timer *t);
  603. long StopTimer(Timer *t);                    // µs
  604. double StopTimerSecs(Timer *t);                // s
  605.  
  606. /* TitleBarHeight.c */
  607.  
  608. int TitleBarHeight(WindowPtr window);
  609.  
  610. /* TrapAvailable.c */
  611.  
  612. Boolean    TrapAvailable(short theTrap);
  613.  
  614. /* Uniform.c */
  615.  
  616. double UniformSample(void);
  617.  
  618. /* VBLInterruptServiceRoutine */
  619. struct VBLTaskAndA5 {
  620.     volatile VBLTask vbl;
  621.     long ourA5;
  622.     void (*subroutine)(struct VBLTaskAndA5 *vblData);
  623.     GDHandle device;
  624.     long slot;
  625.     volatile long newFrame;                // Boolean
  626.     volatile long framesLeft;            // count down to zero
  627.     long framesDesired;
  628.     Timer *frameTimer;                    // time ms since last VBL interrupt, see Timer.c
  629.     void *ptr;                            // use this for whatever you want
  630. };
  631. typedef struct VBLTaskAndA5 VBLTaskAndA5;
  632.  
  633. OSErr VBLInstall(VBLTaskAndA5 *vblData,GDHandle device,int frames);
  634. OSErr VBLRemove(VBLTaskAndA5 *vblData);
  635. void VBLInterruptServiceRoutine(void);
  636. void SimpleVBLSubroutine(VBLTaskAndA5 *vblData);
  637.  
  638. /* VideoTFB.c */
  639.  
  640. Boolean TFBInSlot(int slot);
  641. void    SetUpTFB(int slot);
  642. void    RampClutTFB(int slot);
  643. void    GrayClutTFB(int slot);
  644. void    LoadClutTFB(int slot,unsigned char rgb[256][3]);
  645. void    NewBlankingTFB(int slot);
  646. void    NewFieldTFB(int slot);
  647. int        BlankingTFB(int slot);
  648. void    SetDepthTFB(int slot,short int bits);
  649. void    SynchSetDepthTFB(int masterSlot,int slot,short int bits);
  650. void    SynchToMainDeviceTFB(GDHandle device);
  651. void    HaltTFB(int slot);
  652. void    RestartTFB(int slot,short int bits);
  653. void    HaltDeviceTFB(GDHandle device);
  654. void    RestartDeviceTFB(GDHandle device);
  655. void    ScrollTFB(int slot,short int bits,long x,long y);
  656. void    PanTFB(int slot,long int x);
  657.  
  658. /* VLambda.c */
  659.  
  660. double VLambda(double nm);
  661. double VLambdaPrime(double nm);
  662.  
  663. /* Zoom.c */
  664.  
  665. void Zoom(WindowPtr theWindow,int zoomDir);
  666.  
  667.  
  668. #endif _VIDEOTOOLBOX_
  669.